﻿<!DOCTYPE html>
<html>
<head>
    <title>欢迎登陆</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" charset="utf-8" />
    <link href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" rel="stylesheet" type="text/css" />
    <%--<link href="jquery.mobile-1.3.2.css" rel="stylesheet" type="text/css" />--%>
    <link href="mobiscroll.custom-2.5.0.min.css" rel="stylesheet" type="text/css" />
    <script src="http://code.jquery.com/jquery-1.11.2.min.js" type="text/javascript"></script>
    <%--<script src="jquery-1.11.2.min.js" type="text/javascript"></script>--%>
    <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js" type="text/javascript"></script>
    <%--<script src="jquery.mobile-1.3.2.js" type="text/javascript"></script>--%>
    <link href="Micro-Website.css" rel="stylesheet" type="text/css" />
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <link href="photoswipe.css" rel="stylesheet" type="text/css" />
    <script src="klass.min.js" type="text/javascript"></script>
    <script src="code.photoswipe-3.0.5.min.js" type="text/javascript"></script>
    <script src="mobiscroll.custom-2.5.0.min.js" type="text/javascript"></script>
    <script src="xxl.base.js" type="text/javascript"></script>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function onBridgeReady() {
            WeixinJSBridge.call('hideToolbar');
            WeixinJSBridge.call('hideOptionMenu');
        }

        if (typeof WeixinJSBridge == "undefined") {
            if (document.addEventListener) {
                document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
            } else if (document.attachEvent) {
                document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
            }
        } else {
            onBridgeReady();
        }
    </script>
</head>
<body>
    <div>
 
        <section data-role="page" id="login_main">
        <div data-role="header"></div>
            <div data-role="content" id="login_content">
                <fieldset data-role="controlgroup">
                    <legend>
                        <img src="images/MemInformation.png" alt="" />
	               	    欢迎登陆
                    </legend>
<%--                     <div data-role="fieldcontain">--%>
                    <label for="memname">登录账号</label>
                    <input type="text" id="memname" placeholder="请输入您的/卡号/手机号" runat="server"/>
                    <label for="telnumber">登录密码</label>
                    <input type="password" id="telnumber" placeholder="请输入您的密码" runat="server" />
                    <label for="telnumber">验证码</label>
                    <input type="text" id="YanZhengMa" placeholder="请输入下面的验证码" runat="server"/>
                     <a href="javascript:void(0);" onclick="javascript:Login_ChangeValImg();">
                     <img id="Login_ValImg" src="" style="height: 30px; width: 90px; border: 0" alt=""  title="看不清？换一个" align="top" /></a><br />
                  <%-- </div>--%>

                    <%--<div data-role="controlgroup" data-type="horizontal">--%>
                    <br />
                    <a href="#login" data-role="button" data-theme="b"  id="loginSumbit" data-shadow="true"  data-corners="true">立即登录</a><br />
                    
                    <a href="#" style="display:none;" data-role="button" data-theme="b"   id="register" data-shadow="true"  data-corners="true">我要注册</a><br />

                    <a href="#index" data-role="button" data-theme="b" style="display:none;" id="goBack">返回首页</a>

                    <input type="hidden"  id="hidUrl" runat="server"/>

                   <%-- </div>--%>
                </fieldset>
            </div>
            <script type="text/javascript">
                $(document).ready(function () {



                    


                    Login_ChangeValImg();
                    $("#loginSumbit").click(function () {
                        var uid = $.trim($("#memname").val());
                        var pwd = $.trim($("#telnumber").val());
                        var Yanzheng = $.trim($("#YanZhengMa").val());
                        if (uid == "") {
                            alert("卡号不能为空！")
                            return;
                        }
                        $.get("../Service/AjaxService.ashx?Method=WeiXinLogin",
                    {
                        "uid": uid,
                        "pwd": pwd,
                        "Yanzheng": Yanzheng
                    }
                    , function (text) {
                        if (text == "2") {
                            location.href = "index.aspx?r=<%=new Random().Next(100000,999999) %>";                 
                            return;
                        }
                        else if (text == "3") {
                            alert("验证码错误！"); Login_ChangeValImg();
                            return;
                        }
                        else if (text == "3") {
                            alert("验证码错误！");
                            Login_ChangeValImg();
                            return;
                        } else if (text == "4") {
                            alert('您的卡号已锁定，暂时无法登录');
                            return;
                        } else if (text == "5") {
                            alert('您的卡号已过期，暂时无法登录');
                            return;
                        }
                        else {
                            $("#memname").val("");
                            $("#telnumber").val("");
                            $("#YanZhengMa").val("");
                            alert("登录失败，用户名或密码错误！");
                            Login_ChangeValImg();
                        }
                        $("#goBack").click();
                    }, "text")
                    })

                    $("#register").click(function(){
                        location.href = $("#hidUrl").val();
                        //location.href = "register.aspx";
                    })

                });

                function ChangeValImg() {
                    $("#Login_ValImg").attr("src", "../Service/ValidateImage.ashx?" + GetGuid());
                }

                function Login_ChangeValImg() {                
                    ChangeValImg();
                    setTimeout("Login_ChangeValImg()", 60 * 1000 * 3);
                }

                function GetGuid() {
                    var now = new Date();
                    var year = now.getFullYear(); //getFullYear getYear
                    var month = now.getMonth();
                    var date = now.getDate();
                    var day = now.getDay();
                    var hour = now.getHours();
                    var minu = now.getMinutes();
                    var sec = now.getSeconds();
                    var mill = now.getMilliseconds();
                    month = month + 1;
                    if (month < 10) month = "0" + month;
                    if (date < 10) date = "0" + date;
                    if (hour < 10) hour = "0" + hour;
                    if (minu < 10) minu = "0" + minu;
                    if (sec < 10) sec = "0" + sec;
                    var guid = month + date + hour + minu + sec + mill;
                    return guid;
                }

            </script>
            <footer data-role="footer" data-position="fixed" id="login_footer">
            </footer>
        </section>
    </div>
</body>
</html>

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login"
    EnableViewState="false" %>

